<?
include_once "../main.php";

if(empty($n))
{
$n = '1';
}
else 
{
$n = $n + 1;
}

?>


<SCRIPT LANGUAGE="JavaScript">

function checkFields() {
missinginfo = "";

if (document.form.WE_p.value == "") {
missinginfo += "\n     -  Position";
}
if (document.form.WSmonth.value == "") {
missinginfo += "\n     -  Start date / Month";
}
if (document.form.WSyear.value == "") {
missinginfo += "\n     -  Start date / Year";
}
if (document.form.WEmonth.value == "") {
missinginfo += "\n     -  End date / Month";
}
if (document.form.WEyear.value == "") {
missinginfo += "\n     -  End date / Year";
}
if (document.form.WE_d.value == "") {
missinginfo += "\n     -  Description";
}

if(document.form.WSyear.value > document.form.WEyear.value) {
missinginfo += "\nSelect correct values for start and end years, please!";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}

</script>

<form method=post action="<?=$PHP_SELF?>"  name=form onSubmit="return checkFields();">
<table align=center class=BlackText>
<tr>
	<td colspan=2 align=center class=HeaderClass>
		<b>Work experience #<?=$n?></b>
	</td>
</tr>

<tr>
	<td align=right><b>Position: </b> </td>
	<td><input type=text name=WE_p size=27></td>
</tr>

<tr>
	<td align=right><b>Start date: </b></td>

	<td>
	<select name=WSmonth>
	<option value=""> Month </option>
	<option value=January> January </option>
	<option value=February> February </option>
	<option value=March> March </option>
	<option value=April> April </option>
	<option value=May> May </option>
	<option value=June> June </option>
	<option value=July> July </option>
	<option value=August> August </option>
	<option value=September> September </option>
	<option value=October> October </option>
	<option value=November> November </option>
	<option value=December> December </option>
	</select>

	<select name=WSyear>
	<option value=""> Year &nbsp;&nbsp;&nbsp;&nbsp;</option>
	<?
	for($i = date(Y); $i >= date(Y) - 70; $i--)
	{
		echo "<option value=\"$i\">$i</option>\n\t";
	}
	?>	
	</select>
	</td>
</tr>

<tr>
	<td align=right><b> End date: </b></td>

	<td>
	<select name=WEmonth>
	<option value=""> Month </option>
	<option value=Present class=Pres> Present </option>
	<option value=January> January </option>
	<option value=February> February </option>
	<option value=March> March </option>
	<option value=April> April </option>
	<option value=May> May </option>
	<option value=June> June </option>
	<option value=July> July </option>
	<option value=August> August </option>
	<option value=September> September </option>
	<option value=October> October </option>
	<option value=November> November </option>
	<option value=December> December </option>
	</select>

	<select name=WEyear>
	<option value=""> Year </option>
	<option value=Present class=Pres>Present </option>
	<?
	for($i = date(Y) - 1; $i >= date(Y) - 70; $i--)
	{
		echo "<option value=\"$i\">$i</option>\n\t";
	}
	?>
	</select>
	</td>
</tr>

<tr>
	<td valign=top align=right><b>Description: </b><br>(do not use HTML, please)</td>
	<td><textarea name=WE_d rows=6 cols=32></textarea><br><br></td>
</tr>

<tr>
	<td colspan=2 align=center>
	<input type=submit name=submit value="Save this and add another one">
	<input type=hidden name=n value=<?=$n?>>
	</td>
</tr>

<tr>
	<td colspan=2 align=center>
	<input type=submit name=submit value="Save this and go to Step 2 (Education)">
	<input type=hidden name=n value=<?=$n?>>
	

</table>

<? include_once('../footer.php'); ?>